#include <iostream>
#include <string.h>
#include <X11/extensions/Xrandr.h>
#include <X11/Xlib.h>

int main()
{
    Display *display = XOpenDisplay(NULL);
    Window window = DefaultRootWindow(display);
    int monitors = 0;
    XRRMonitorInfo *info = XRRGetMonitors(display, window, True, &monitors);
    for (int i = 0; i < monitors; i++)
    {
        XID id;
        RROutput *out = info[i].outputs;
        memcpy(&id, out, sizeof(RROutput));
        std::cout << "XRRMonitorInfo: "
                  << "index:" << i << " primary:" << info[i].primary << " noutput:" << info[i].noutput << " width:" << info[i].width << " height:" << info[i].height << " x :" << info[i].x << " y:" << info[i].y
                  << " widthmm:" << info[i].mwidth << " heightm:" << info[i].mheight << " outputs:" << id << std::endl;
    }
    XRRFreeMonitors(info);
    XFree(display);

    return 0;
}